#delimit ;
set more off;

/*NOTE: For a Mac, file path names use a forward slash (/) but for 
PC's they require a backward slash (\). Make these changes below 
if necessary depending on your computer type. 
*/

*Dropbox paths by user;
if c(username)=="shayaksarkar" {;
	local path "/Users/shayaksarkar/Desktop/ReStat_Data_Publication";
};


/*TABLE A4*/;

cd `path';

use "`path'/dta/final_competition.dta", clear;

*set file to which all putexcel commands will refer;
putexcel set "`path'/out/tableA4.xls", replace;

putexcel A2=("Appendix 4 - Table") A3=("Type of Recommendation") B3=("Number of Audits")
C3=("Mean Premium") D3=("Mean Years Income Replacement");
local i=4;
foreach var in onlyterm anyterm onlywhole anywhole {;
sum total_premium_rec if `var'==1 & (sl_number!=417);
putexcel A`i'=("`var'-dropmax") B`i'=(r(N)) C`i'=(r(mean));
sum riratio if `var'==1 & (sl_number!=417);
putexcel D`i'=(r(mean));
local i=`i'+1;
	};
	
*Note: Excludes Max Observation;
